package com.ljtg.ljtgpojo.dto;

import com.ljtg.ljtgpojo.entity.CommodityDetail;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

@Data
@Schema(name = "CommodityDTO", description = "商品数据传输对象")
public class CommodityDTO {

    @Schema(description = "主键", example = "1")
    private Long id;

    @Schema(description = "商品名称", example = "iPhone 13")
    private String name;

    @Schema(description = "分类ID", example = "101")
    private Long categoryId;

    @Schema(description = "销售时间", example = "2023-10-01")
    private LocalDate saleTime;

    @Schema(description = "价格", example = "999.99")
    private BigDecimal price;

    @Schema(description = "图片URL", example = "https://example.com/iphone13.jpg")
    private String image;

    @Schema(description = "商品描述", example = "最新款iPhone，性能强劲")
    private String description;

    @Schema(
            description = "商品详情列表",
            implementation = CommodityDetail.class,
            example = "[{\"id\": 101, \"commodityId\": 1, \"name\": \"颜色\", \"value\": \"红色,蓝色,黑色\"}, " +
                    "{\"id\": 102, \"commodityId\": 1, \"name\": \"内存\", \"value\": \"128GB,256GB,512GB\"}]"
    )
    private List<CommodityDetail> details = new ArrayList<>();
}